package com.qfedu.controller;

import com.qfedu.entity.ResultVo;
import com.qfedu.service.UserService;
import com.qfedu.vo.RegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.sql.DataSource;

/**
 * 作者：刘随阳
 * 时间: 2021/9/18 15:30
 * 描述：神光照耀,太白成瑞。六丙来迎,百福悠归
 */
@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;



    @GetMapping("/login")
    public ResultVo login(  String username,String password){
        ResultVo login = userService.login(username, password);
        return  login;
    }

    @PostMapping("/register")
    public ResultVo register(
            @RequestBody RegisterVo registerVo){
        return userService.register(registerVo.getUsername(),registerVo.getPassword(),registerVo.getPhone(),registerVo.getCode());
    }
}
